<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.13"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>fastText: /data/users/cpuhrsch/fbsource/fbcode/deeplearning/fastText/src/vector.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="favicon.png"/></td>
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">fastText
   &#160;<span id="projectnumber">d00d36476b15</span>
   </div>
   <div id="projectbrief">Fast text processing tool/library</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.13 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('vector_8h_source.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="headertitle">
<div class="title">vector.h</div>  </div>
</div><!--header-->
<div class="contents">
<a href="vector_8h.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;</div><div class="line"><a name="l00010"></a><span class="lineno">   10</span>&#160;<span class="preprocessor">#ifndef FASTTEXT_VECTOR_H</span></div><div class="line"><a name="l00011"></a><span class="lineno">   11</span>&#160;<span class="preprocessor">#define FASTTEXT_VECTOR_H</span></div><div class="line"><a name="l00012"></a><span class="lineno">   12</span>&#160;</div><div class="line"><a name="l00013"></a><span class="lineno">   13</span>&#160;<span class="preprocessor">#include &lt;cstdint&gt;</span></div><div class="line"><a name="l00014"></a><span class="lineno">   14</span>&#160;<span class="preprocessor">#include &lt;ostream&gt;</span></div><div class="line"><a name="l00015"></a><span class="lineno">   15</span>&#160;</div><div class="line"><a name="l00016"></a><span class="lineno">   16</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="real_8h.html">real.h</a>&quot;</span></div><div class="line"><a name="l00017"></a><span class="lineno">   17</span>&#160;</div><div class="line"><a name="l00018"></a><span class="lineno">   18</span>&#160;<span class="keyword">namespace </span><a class="code" href="namespacefasttext.html">fasttext</a> {</div><div class="line"><a name="l00019"></a><span class="lineno">   19</span>&#160;</div><div class="line"><a name="l00020"></a><span class="lineno">   20</span>&#160;<span class="keyword">class </span>Matrix;</div><div class="line"><a name="l00021"></a><span class="lineno">   21</span>&#160;<span class="keyword">class </span>QMatrix;</div><div class="line"><a name="l00022"></a><span class="lineno">   22</span>&#160;</div><div class="line"><a name="l00023"></a><span class="lineno"><a class="line" href="classfasttext_1_1Vector.html">   23</a></span>&#160;<span class="keyword">class </span><a class="code" href="classfasttext_1_1Vector.html">Vector</a> {</div><div class="line"><a name="l00024"></a><span class="lineno">   24</span>&#160;</div><div class="line"><a name="l00025"></a><span class="lineno">   25</span>&#160;  <span class="keyword">public</span>:</div><div class="line"><a name="l00026"></a><span class="lineno"><a class="line" href="classfasttext_1_1Vector.html#a97bc75d46013e08d43881e1ee3725491">   26</a></span>&#160;    int64_t <a class="code" href="classfasttext_1_1Vector.html#a97bc75d46013e08d43881e1ee3725491">m_</a>;</div><div class="line"><a name="l00027"></a><span class="lineno"><a class="line" href="classfasttext_1_1Vector.html#ab177f24ed7071636dcd17e90a746dd2e">   27</a></span>&#160;    <a class="code" href="namespacefasttext.html#a7afdad102f318271c14154b8e65e5ea3">real</a>* <a class="code" href="classfasttext_1_1Vector.html#ab177f24ed7071636dcd17e90a746dd2e">data_</a>;</div><div class="line"><a name="l00028"></a><span class="lineno">   28</span>&#160;</div><div class="line"><a name="l00029"></a><span class="lineno">   29</span>&#160;    <span class="keyword">explicit</span> <a class="code" href="classfasttext_1_1Vector.html#ab7f9177915b3d3837213abb15de9b939">Vector</a>(int64_t);</div><div class="line"><a name="l00030"></a><span class="lineno">   30</span>&#160;    <a class="code" href="classfasttext_1_1Vector.html#aedde9ca3a3952dfd54addd21f8a63506">~Vector</a>();</div><div class="line"><a name="l00031"></a><span class="lineno">   31</span>&#160;</div><div class="line"><a name="l00032"></a><span class="lineno">   32</span>&#160;    <a class="code" href="namespacefasttext.html#a7afdad102f318271c14154b8e65e5ea3">real</a>&amp; <a class="code" href="classfasttext_1_1Vector.html#ad60a80620d695fc64062b9b493bc6232">operator[]</a>(int64_t);</div><div class="line"><a name="l00033"></a><span class="lineno">   33</span>&#160;    <span class="keyword">const</span> <a class="code" href="namespacefasttext.html#a7afdad102f318271c14154b8e65e5ea3">real</a>&amp; <a class="code" href="classfasttext_1_1Vector.html#ad60a80620d695fc64062b9b493bc6232">operator[]</a>(int64_t) <span class="keyword">const</span>;</div><div class="line"><a name="l00034"></a><span class="lineno">   34</span>&#160;</div><div class="line"><a name="l00035"></a><span class="lineno">   35</span>&#160;    int64_t <a class="code" href="classfasttext_1_1Vector.html#af3e8aa155da430d0911896d53db6789d">size</a>() <span class="keyword">const</span>;</div><div class="line"><a name="l00036"></a><span class="lineno">   36</span>&#160;    <span class="keywordtype">void</span> <a class="code" href="classfasttext_1_1Vector.html#af0cd17b1bbdf212780c31e427e982793">zero</a>();</div><div class="line"><a name="l00037"></a><span class="lineno">   37</span>&#160;    <span class="keywordtype">void</span> <a class="code" href="classfasttext_1_1Vector.html#af14f0011942b0a98562ca2f677aa4395">mul</a>(<a class="code" href="namespacefasttext.html#a7afdad102f318271c14154b8e65e5ea3">real</a>);</div><div class="line"><a name="l00038"></a><span class="lineno">   38</span>&#160;    <a class="code" href="namespacefasttext.html#a7afdad102f318271c14154b8e65e5ea3">real</a> <a class="code" href="classfasttext_1_1Vector.html#aa88e78466e3db802c403f6fe13421ff6">norm</a>() <span class="keyword">const</span>;</div><div class="line"><a name="l00039"></a><span class="lineno">   39</span>&#160;    <span class="keywordtype">void</span> <a class="code" href="classfasttext_1_1Vector.html#aef57a1c3a853b8691f544e9f881a3394">addVector</a>(<span class="keyword">const</span> <a class="code" href="classfasttext_1_1Vector.html">Vector</a>&amp; source);</div><div class="line"><a name="l00040"></a><span class="lineno">   40</span>&#160;    <span class="keywordtype">void</span> <a class="code" href="classfasttext_1_1Vector.html#aef57a1c3a853b8691f544e9f881a3394">addVector</a>(<span class="keyword">const</span> <a class="code" href="classfasttext_1_1Vector.html">Vector</a>&amp;, <a class="code" href="namespacefasttext.html#a7afdad102f318271c14154b8e65e5ea3">real</a>);</div><div class="line"><a name="l00041"></a><span class="lineno">   41</span>&#160;    <span class="keywordtype">void</span> <a class="code" href="classfasttext_1_1Vector.html#a94d369014b965b42ead2deb5e3fa0b11">addRow</a>(<span class="keyword">const</span> <a class="code" href="classfasttext_1_1Matrix.html">Matrix</a>&amp;, int64_t);</div><div class="line"><a name="l00042"></a><span class="lineno">   42</span>&#160;    <span class="keywordtype">void</span> <a class="code" href="classfasttext_1_1Vector.html#a94d369014b965b42ead2deb5e3fa0b11">addRow</a>(<span class="keyword">const</span> <a class="code" href="classfasttext_1_1QMatrix.html">QMatrix</a>&amp;, int64_t);</div><div class="line"><a name="l00043"></a><span class="lineno">   43</span>&#160;    <span class="keywordtype">void</span> <a class="code" href="classfasttext_1_1Vector.html#a94d369014b965b42ead2deb5e3fa0b11">addRow</a>(<span class="keyword">const</span> <a class="code" href="classfasttext_1_1Matrix.html">Matrix</a>&amp;, int64_t, <a class="code" href="namespacefasttext.html#a7afdad102f318271c14154b8e65e5ea3">real</a>);</div><div class="line"><a name="l00044"></a><span class="lineno">   44</span>&#160;    <span class="keywordtype">void</span> <a class="code" href="classfasttext_1_1Vector.html#af14f0011942b0a98562ca2f677aa4395">mul</a>(<span class="keyword">const</span> <a class="code" href="classfasttext_1_1QMatrix.html">QMatrix</a>&amp;, <span class="keyword">const</span> <a class="code" href="classfasttext_1_1Vector.html">Vector</a>&amp;);</div><div class="line"><a name="l00045"></a><span class="lineno">   45</span>&#160;    <span class="keywordtype">void</span> <a class="code" href="classfasttext_1_1Vector.html#af14f0011942b0a98562ca2f677aa4395">mul</a>(<span class="keyword">const</span> <a class="code" href="classfasttext_1_1Matrix.html">Matrix</a>&amp;, <span class="keyword">const</span> <a class="code" href="classfasttext_1_1Vector.html">Vector</a>&amp;);</div><div class="line"><a name="l00046"></a><span class="lineno">   46</span>&#160;    int64_t <a class="code" href="classfasttext_1_1Vector.html#a5ca06ee0880c24409faad3e69a920d9a">argmax</a>();</div><div class="line"><a name="l00047"></a><span class="lineno">   47</span>&#160;};</div><div class="line"><a name="l00048"></a><span class="lineno">   48</span>&#160;</div><div class="line"><a name="l00049"></a><span class="lineno">   49</span>&#160;std::ostream&amp; <a class="code" href="namespacefasttext.html#a23eb4596f3beb9859b22cf64a83461d6">operator&lt;&lt;</a>(std::ostream&amp;, <span class="keyword">const</span> <a class="code" href="classfasttext_1_1Vector.html">Vector</a>&amp;);</div><div class="line"><a name="l00050"></a><span class="lineno">   50</span>&#160;</div><div class="line"><a name="l00051"></a><span class="lineno">   51</span>&#160;}</div><div class="line"><a name="l00052"></a><span class="lineno">   52</span>&#160;</div><div class="line"><a name="l00053"></a><span class="lineno">   53</span>&#160;<span class="preprocessor">#endif</span></div><div class="ttc" id="classfasttext_1_1Vector_html_af0cd17b1bbdf212780c31e427e982793"><div class="ttname"><a href="classfasttext_1_1Vector.html#af0cd17b1bbdf212780c31e427e982793">fasttext::Vector::zero</a></div><div class="ttdeci">void zero()</div><div class="ttdef"><b>Definition:</b> vector.cc:35</div></div>
<div class="ttc" id="classfasttext_1_1Vector_html_af3e8aa155da430d0911896d53db6789d"><div class="ttname"><a href="classfasttext_1_1Vector.html#af3e8aa155da430d0911896d53db6789d">fasttext::Vector::size</a></div><div class="ttdeci">int64_t size() const</div><div class="ttdef"><b>Definition:</b> vector.cc:31</div></div>
<div class="ttc" id="classfasttext_1_1Vector_html_ad60a80620d695fc64062b9b493bc6232"><div class="ttname"><a href="classfasttext_1_1Vector.html#ad60a80620d695fc64062b9b493bc6232">fasttext::Vector::operator[]</a></div><div class="ttdeci">real &amp; operator[](int64_t)</div><div class="ttdef"><b>Definition:</b> vector.cc:120</div></div>
<div class="ttc" id="namespacefasttext_html"><div class="ttname"><a href="namespacefasttext.html">fasttext</a></div><div class="ttdef"><b>Definition:</b> args.cc:17</div></div>
<div class="ttc" id="classfasttext_1_1Vector_html"><div class="ttname"><a href="classfasttext_1_1Vector.html">fasttext::Vector</a></div><div class="ttdef"><b>Definition:</b> vector.h:23</div></div>
<div class="ttc" id="classfasttext_1_1Vector_html_ab177f24ed7071636dcd17e90a746dd2e"><div class="ttname"><a href="classfasttext_1_1Vector.html#ab177f24ed7071636dcd17e90a746dd2e">fasttext::Vector::data_</a></div><div class="ttdeci">real * data_</div><div class="ttdef"><b>Definition:</b> vector.h:27</div></div>
<div class="ttc" id="classfasttext_1_1Vector_html_a5ca06ee0880c24409faad3e69a920d9a"><div class="ttname"><a href="classfasttext_1_1Vector.html#a5ca06ee0880c24409faad3e69a920d9a">fasttext::Vector::argmax</a></div><div class="ttdeci">int64_t argmax()</div><div class="ttdef"><b>Definition:</b> vector.cc:108</div></div>
<div class="ttc" id="real_8h_html"><div class="ttname"><a href="real_8h.html">real.h</a></div></div>
<div class="ttc" id="classfasttext_1_1Vector_html_a94d369014b965b42ead2deb5e3fa0b11"><div class="ttname"><a href="classfasttext_1_1Vector.html#a94d369014b965b42ead2deb5e3fa0b11">fasttext::Vector::addRow</a></div><div class="ttdeci">void addRow(const Matrix &amp;, int64_t)</div><div class="ttdef"><b>Definition:</b> vector.cc:69</div></div>
<div class="ttc" id="classfasttext_1_1Vector_html_ab7f9177915b3d3837213abb15de9b939"><div class="ttname"><a href="classfasttext_1_1Vector.html#ab7f9177915b3d3837213abb15de9b939">fasttext::Vector::Vector</a></div><div class="ttdeci">Vector(int64_t)</div><div class="ttdef"><b>Definition:</b> vector.cc:22</div></div>
<div class="ttc" id="classfasttext_1_1Vector_html_af14f0011942b0a98562ca2f677aa4395"><div class="ttname"><a href="classfasttext_1_1Vector.html#af14f0011942b0a98562ca2f677aa4395">fasttext::Vector::mul</a></div><div class="ttdeci">void mul(real)</div><div class="ttdef"><b>Definition:</b> vector.cc:49</div></div>
<div class="ttc" id="namespacefasttext_html_a7afdad102f318271c14154b8e65e5ea3"><div class="ttname"><a href="namespacefasttext.html#a7afdad102f318271c14154b8e65e5ea3">fasttext::real</a></div><div class="ttdeci">float real</div><div class="ttdef"><b>Definition:</b> real.h:15</div></div>
<div class="ttc" id="classfasttext_1_1Matrix_html"><div class="ttname"><a href="classfasttext_1_1Matrix.html">fasttext::Matrix</a></div><div class="ttdef"><b>Definition:</b> matrix.h:23</div></div>
<div class="ttc" id="classfasttext_1_1Vector_html_a97bc75d46013e08d43881e1ee3725491"><div class="ttname"><a href="classfasttext_1_1Vector.html#a97bc75d46013e08d43881e1ee3725491">fasttext::Vector::m_</a></div><div class="ttdeci">int64_t m_</div><div class="ttdef"><b>Definition:</b> vector.h:26</div></div>
<div class="ttc" id="namespacefasttext_html_a23eb4596f3beb9859b22cf64a83461d6"><div class="ttname"><a href="namespacefasttext.html#a23eb4596f3beb9859b22cf64a83461d6">fasttext::operator&lt;&lt;</a></div><div class="ttdeci">std::ostream &amp; operator&lt;&lt;(std::ostream &amp;os, const Vector &amp;v)</div><div class="ttdef"><b>Definition:</b> vector.cc:128</div></div>
<div class="ttc" id="classfasttext_1_1Vector_html_aedde9ca3a3952dfd54addd21f8a63506"><div class="ttname"><a href="classfasttext_1_1Vector.html#aedde9ca3a3952dfd54addd21f8a63506">fasttext::Vector::~Vector</a></div><div class="ttdeci">~Vector()</div><div class="ttdef"><b>Definition:</b> vector.cc:27</div></div>
<div class="ttc" id="classfasttext_1_1QMatrix_html"><div class="ttname"><a href="classfasttext_1_1QMatrix.html">fasttext::QMatrix</a></div><div class="ttdef"><b>Definition:</b> qmatrix.h:29</div></div>
<div class="ttc" id="classfasttext_1_1Vector_html_aa88e78466e3db802c403f6fe13421ff6"><div class="ttname"><a href="classfasttext_1_1Vector.html#aa88e78466e3db802c403f6fe13421ff6">fasttext::Vector::norm</a></div><div class="ttdeci">real norm() const</div><div class="ttdef"><b>Definition:</b> vector.cc:41</div></div>
<div class="ttc" id="classfasttext_1_1Vector_html_aef57a1c3a853b8691f544e9f881a3394"><div class="ttname"><a href="classfasttext_1_1Vector.html#aef57a1c3a853b8691f544e9f881a3394">fasttext::Vector::addVector</a></div><div class="ttdeci">void addVector(const Vector &amp;source)</div><div class="ttdef"><b>Definition:</b> vector.cc:55</div></div>
</div><!-- fragment --></div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><a class="el" href="dir_68267d1309a1af8e8297ef4c3efbcdba.html">src</a></li><li class="navelem"><a class="el" href="vector_8h.html">vector.h</a></li>
    <li class="footer">Generated by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.13 </li>
  </ul>
</div>
</body>
</html>
